
#pragma once
#include "export.h"
#include "BaseEditor.h"
#include "NodeEditor.h"
#include "OgitorsRoot.h"
#include "stageSide.h"


namespace Ogitors
{

	class PluginExport stageEditor : public CNodeEditor
	{
		friend class CStageEditorFactory;
	public:

		virtual void            GetObjectUserData(std::ofstream &outfile);

		virtual void            GetObjectProperties(Ogre::NameValuePairList &retList);
		virtual void			SetHandle(void *objHandle,bool display);
		virtual bool			SetupPropertiesWnd();
		virtual void            FreeHandle();
		virtual void            ShowBoundingBox(bool bShow);
		virtual Ogre::AxisAlignedBox GetAABB() {return m_PlaneHandle->getBoundingBox();};
		/// Overridden by Editor Objects to Import Object Dependant Properties
		virtual CBaseEditor    *Restore(Ogre::NameValuePairList &retList);
		/// Gets the Handle to encapsulated object
		inline virtual void    *GetHandle() {return static_cast<void*>(m_PlaneHandle);};
		/// Returns the Factory associated with this object
		static CBaseEditorFactory *GetFactory();
		/// Returns the Factory associated with this object can be overridden
		virtual CBaseEditorFactory *GetFactoryDynamic();
		/// Gets Object's Cast Shadows Property 
		virtual bool			GetCastShadows() {return m_PlaneHandle->getCastShadows();};

		virtual void			SetCastShadows(int BIND_ID,Ogre::String val,bool refresh);
		virtual void			SetMeshFileName(int BIND_ID,Ogre::String val,bool refresh) ;

		void					zhanwei(const Ogre::String& type);
       // void                    readzhanwei(const Ogre::String& filename);


	protected:

		stageSide     m_stageSide;
		Ogre::String  m_currentzhanwei;
        Ogre::StringVector m_zhanweiList;

		Ogre::Entity *m_PlaneHandle;
		Ogre::Vector3 m_Normal;
		Ogre::Real    m_Distance;
		Ogre::Real    m_Width;
		Ogre::Real    m_Height;
		int           m_xSegments;
		int           m_ySegments;
		int           m_NumCoordSets;
		int           m_uTile;
		int           m_vTile;
		bool          m_HasNormals;


		Ogre::SceneNode *	m_npcNode[MAXHOTPOSNUM];
		Ogre::Entity *		m_Entitynpc[MAXHOTPOSNUM];


		stageEditor(Ogre::String typestring = "Stage Object", EDITORTYPE etype = ETYPE_PLANE);
		virtual       ~stageEditor() {};
		virtual bool  HandleCustomFunction(int BIND_ID,Ogre::String val);
		Ogre::Entity *CreatePlane();
	};

	class PluginExport CStageEditorFactory: public CBaseEditorFactory
	{
	public:
		CStageEditorFactory() {};
		virtual ~CStageEditorFactory() {};
		virtual CBaseEditor *CreateObject(CBaseEditor **parent, Ogre::NameValuePairList &params);
	};

}
